package com.brooks.demo;

/**
 * 单例模式 懒汉式
 * 会有线程安全的问题
 * @Author: mihutu
 * @Date: 2020/10/11 21:47
 */

public class DemoSingleton2 {
    private static DemoSingleton2 singleton ;

    private DemoSingleton2() {

    }

    public static DemoSingleton2 getInstance() {
        if (singleton == null){
            singleton = new DemoSingleton2();
        }
        return singleton;
    }
}
